package com.andy.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.andy.service.IManageStudentScoreService;
import com.andy.vo.ExamScoreVO;

@Controller
@RequestMapping(value = "/teacher")
public class ManageStudentScoreController {
	
	@Autowired
	private IManageStudentScoreService manageStudentScoreService;
	
	/**
	 * 跳转页面
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/toManageStudentScore")
	public String toManageStudentScore(Model model) {
		List<ExamScoreVO> examScoreList = manageStudentScoreService.getAllStudentScore(null);	//没有条件
		model.addAttribute("examScoreList", examScoreList);
		return "teacher/manageStudentScore";
	}
	
	/**
	 * 带条件查询
	 * @param searchType
	 * @param searchValue
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/search")
	public List<ExamScoreVO> search(String searchType, String searchValue) {
		Map<String, String> searchMap = new HashMap<String, String>();
		searchMap.put(searchType, searchValue);
		List<ExamScoreVO> examScoreList = manageStudentScoreService.getAllStudentScore(searchMap );	//有条件
		return examScoreList;
	}
		
}
